package com.kpx.app.adapter;

import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
import android.view.View;

import jp.wasabeef.recyclerview.animators.holder.AnimateViewHolder;

/**
 * 创建时间： 2015/7/1 11:07
 * 作者：Ryan
 * 类描述：
 */
public class BaseViewHolder extends AnimateViewHolder {
    public BaseViewHolder(View itemView) {
        super(itemView);
    }

    @Override
    public void animateRemoveImpl(ViewPropertyAnimatorListener listener) {
        ViewCompat.animate(itemView).translationX(-itemView.getWidth() * 0.3f).alpha(0).setDuration(300).setListener(listener).start();
    }

    @Override
    public void preAnimateAddImpl() {
        ViewCompat.setTranslationY(itemView, -itemView.getHeight() * 0.3f);
        ViewCompat.setAlpha(itemView, 0);
    }

    @Override
    public void animateAddImpl(ViewPropertyAnimatorListener listener) {
        ViewCompat.animate(itemView).translationY(0).alpha(1).setDuration(300).setListener(listener).start();
    }
}
